package com.jpcc.vw.onlineRadio.receiver;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.CustomIntent;
import android.content.Intent;

import com.jpcc.vw.onlineRadio.constants.Constants;
import com.jpcc.vw.onlineRadio.service.PlayAlbumRadioService;
import com.jpcc.vw.onlineRadio.utils.ToastUtils;
import com.orhanobut.logger.Logger;

public class SDSReceiver extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
        String action = intent.getAction();
        if (CustomIntent.ACTION_SDS_COMMAND.equals(action)) {


//            Constants.NeedInitDataFlag=false;
            Logger.i(CustomIntent.EXTRA_COMMAND+"----->"+intent.getStringExtra(CustomIntent.EXTRA_COMMAND));
            Logger.i(CustomIntent.EXTRA_REQUEST_ID+"----->"+intent.getStringExtra(CustomIntent.EXTRA_REQUEST_ID));
//            ToastUtils.show(intent.getStringExtra(CustomIntent.EXTRA_REQUEST_ID));

            Intent intentServcie = new Intent(context, PlayAlbumRadioService.class);
            intentServcie.putExtra(CustomIntent.EXTRA_COMMAND,intent.getStringExtra(CustomIntent.EXTRA_COMMAND));
            intentServcie.putExtra(CustomIntent.EXTRA_REQUEST_ID,intent.getStringExtra(CustomIntent.EXTRA_REQUEST_ID));
            intentServcie.setAction(CustomIntent.ACTION_SDS_COMMAND);
            context.startForegroundService(intentServcie);
        }
    }
}
